package com.netx.data;
import com.netx.generics.basic.Checker;


public abstract class EntityInstance {

	private final long _primarykey;
	
	protected EntityInstance(long primaryKey) {
		Checker.checkMinValue(primaryKey, 1, "primaryKey");
		_primarykey = primaryKey;
	}

	public long getPrimaryKey() {
		return _primarykey;
	}

	public boolean equals(Object o) {
		Checker.checkNull(o, "o");
		return equals((EntityInstance)o);
	}

	public boolean equals(EntityInstance ei) {
		Checker.checkNull(ei, "ei");
		return ei.getClass() == getClass() && ei.getPrimaryKey() == getPrimaryKey();
	}
}
